package com.mark.dao;

import com.mark.pojo.User;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface UserMapper {
    //1.用户注册
    int insert(User record);

    //2.校验用户名
    int checkUserName(String username);

    //3.校验邮箱
    int checkEmail(String email);

    //4..用户登录
    User selectLogin(@Param("username") String username,@Param("password") String password);

    //5.根据用户名找回问题信息
    String selectQuestionByUserName(String username);

    //6.检查答案
    int checkAnswer(@Param("username") String username,@Param("question") String question, @Param("answer") String answer);

    //7.修改密码成功
    int updatePasswordByUsername(@Param("username")String username,@Param("passwordNew") String passwordNew);

    //8.检查旧密码
    int checkPassword(@Param("passwordOld")String passwordOld, @Param("id")Integer id);

    //9：更新
    int updateByPrimaryKeySelective(User record);

    //10：根据用户id获取个人信息
    User selectByPrimaryKey(Integer id);

    //11根据用户id查找不用该用户注册的邮箱
    int checkEmailByUserId(@Param("email")String email, @Param("id")Integer id);

    ///------------------------以下是实现后台接口业务的数据交互接口定义------------------------------------------
    List<User> selectList();
    int updateStatusByPrimaryKey(@Param("id") Integer id,@Param("remark") String remark,@Param("enableStatus") Integer status);

    int deleteByPrimaryKey(Integer id);
    int insertSelective(User record);
    int updateByPrimaryKey(User record);

    List<User> searchUsers(@Param("userName") String userName, @Param("userId") Integer userId, @Param("enableStatus") Integer status);

    int selectCount(@Param("role")Integer role);
}